﻿using System;
using System.Collections.Generic;
using System.Text;
using DCRF.Common.Core;
using DCRF.Common.Interface;

namespace DCRF.Common.Connection.Wrappers
{
    public class BlockReference: BlockConnectorBase
    {
        public BlockReference(BlockBase parent, string key)
            : base(parent, key)
        {
        }

        public IBlock GetBlock()
        {
            Guid id = (Guid) Connector.ProcessRequest();

            return parent.GetParentWebBlock(id);
        }

        public List<IBlock> GetBlocks()
        {
            List<IBlock> result = new List<IBlock>();

            foreach (Guid item in Connector.ProcessRequestAll())
            {
                result.Add(parent.GetParentWebBlock(item));
            }

            return result;
        }
    }
}
